*********************************************************************************
*** Appendix A4
*********************************************************************************

* Project: 	International threats and European defense
* Authors: 	Matthias Mader
* Date:		March 2023	

* Data: VW Project, Pane-European survey (W1)

*********************************************************************************

*** Setup

	clear
	set more off            						// Disable partitioned output
	set dp period									// Use comma instead of dot for decimals
	set linesize 80         						// Line size limit to make output more readable
	macro drop _all         						// clear all macros
	set scheme plotplainblind, permanent				// set graph scheme, e.g., cleanplots, plottig, plotplainblind, burd3, s1mono
	graph set window fontface "Times New Roman"		// set font in graphs | "Arial" | "Times New Roman"


*** Appendix A4, Table A4.1

	use DATA_clean, clear

	reg csdp_wouldlike c.threat_ind2 i.idconfig2 i.QCOUNTRY female age ib2.education iso comp mili
	estimate store m1

	reg csdp_wouldlike c.threat_ind2##i.idconfig2 i.QCOUNTRY female age ib2.education iso comp mili
	estimate store m2

	reg csdp_wouldlike c.threat_ind2##i.idconfig2##c.quizr i.QCOUNTRY female age ib2.education iso comp mili 
	estimate store m3


	esttab 	m1 m2 m3 using "A4_1.rtf", replace ///
		b(2) se(2) nogaps compress nobaselevels varwidth(15) ///
		modelwidth(6) nonumbers ///
		title("Pooled regression models") ///
		mtitles("M1" "M2" "M3") ///
		drop()  ///
					coeflabels(threat_ind2 "Threat perception" ///
					2.idconfig2 "Inclusive identity" ///
					3.idconfig2 "No territorial ID" ///
					2.idconfig2#c.threat_ind2 "Inclusive identity * Threat perception" ///
					3.idconfig2#c.threat_ind2 "No territorial ID * Threat perception" ///
					quizr "Political sophistication" ///
					c.threat_ind2#c.quizr "Threat perception * Political sophistication" ///
					2.idconfig2#c.quizr "Inclusive identity * Political sophistication" ///
					3.idconfig2#c.quizr "No territorial ID * Political sophistication" ///
					2.idconfig2#c.threat_ind2#c.quizr "Inclusive identity * Threat perception * Political sophistication" ///
					3.idconfig2#c.threat_ind2#c.quizr "No territorial ID * Threat perception * Political sophistication" ///
 					iso "Isolationism" ///
					comp "Willingness to compromise" ///
					mili "Attitudes towards the use of force" ///
					age "Age (in years)" ///
					female "Gender (female)" ///
					1.education "Formal education: low" ///
					3.education "Formal education: high" ///
					2.QCOUNTRY	"Belgium"	///
					3.QCOUNTRY	"Bulgaria"	///
					4.QCOUNTRY	"Croatia"	///
					5.QCOUNTRY	"Czech Republic"	///
					6.QCOUNTRY	"Denmark"	///
					7.QCOUNTRY	"Estonia"	///
					8.QCOUNTRY	"Finland"	///
					9.QCOUNTRY	"France"	///
					10.QCOUNTRY	"Germany"	///
					11.QCOUNTRY	"Greece"	///
					12.QCOUNTRY	"Hungary"	///
					13.QCOUNTRY	"Ireland"	///
					14.QCOUNTRY	"Italy"	///
					15.QCOUNTRY	"Latvia"	///
					16.QCOUNTRY	"Lithuania"	///
					17.QCOUNTRY	"Netherlands"	///
					18.QCOUNTRY	"Poland"	///
					19.QCOUNTRY	"Portugal"	///
					20.QCOUNTRY	"Romania"	///
					21.QCOUNTRY	"Slovakia"	///
					22.QCOUNTRY	"Slovenia"	///
					23.QCOUNTRY	"Spain"	///
					24.QCOUNTRY	"Sweden"	///
					25.QCOUNTRY	"UK"	///
					_cons "Constant") ///
		order(threat_ind2 2.idconfig2 3.idconfig2 quizr 2.idconfig2#c.threat_ind2 3.idconfig2#c.threat_ind2 c.threat_ind2#c.quizr 2.idconfig2#c.quizr 3.idconfig2#c.quizr 2.idconfig2#c.threat_ind2#c.quizr 3.idconfig2#c.threat_ind2#c.quizr iso comp mili age female 1.education 3.education 2.QCOUNTRY 3.QCOUNTRY 4.QCOUNTRY 5.QCOUNTRY 6.QCOUNTRY 7.QCOUNTRY 8.QCOUNTRY 9.QCOUNTRY 10.QCOUNTRY 11.QCOUNTRY 12.QCOUNTRY 13.QCOUNTRY 14.QCOUNTRY 15.QCOUNTRY 16.QCOUNTRY 17.QCOUNTRY 18.QCOUNTRY 19.QCOUNTRY 20.QCOUNTRY 21.QCOUNTRY 22.QCOUNTRY 23.QCOUNTRY 24.QCOUNTRY 25.QCOUNTRY )


*** Appendix A4, Table A4.2
	
	use DATA_clean, clear

	forvalues val = 1/25 {
	reg csdp_wouldlike c.threat_ind2 i.idconfig2 female age ib2.education iso comp mili if QCOUNTRY==`val'
	estimates store m`val'
}

	esttab 	m1 m2 m3 m4 m5 m6 m7 m8 using "A4_2a.rtf", replace ///
		b(2) se(2) nogaps compress nobaselevels varwidth(15) ///
		modelwidth(6) nonumbers ///
		title("Average effect models, country-by-country (1)") ///
		mtitles("Austria" "Belgium" "Bulgaria" "Croatia" "Czech Republic" "Denmark" "Estonia" "Finland") ///
		drop()  ///
					coeflabels(threat_ind2 "Threat perception" ///
					2.idconfig2 "Inclusive identity" ///
					3.idconfig2 "No territorial ID" ///
					iso "Isolationism" ///
					comp "Willingness to compromise" ///
					mili "Attitudes towards the use of force" ///
					age "Age (in years)" ///
					female "Gender (female)" ///
					1.education "Formal education: low" ///
					3.education "Formal education: high" ///
					_cons "Constant") ///
		order(threat_ind2 2.idconfig2 3.idconfig2 iso comp mili age female 1.education 3.education)

	esttab 	m9 m10 m11 m12 m13 m14 m15 m16 using "A4_2b.rtf", replace ///
			b(2) se(2) nogaps compress nobaselevels varwidth(15) ///
			modelwidth(6) nonumbers ///
			title("Average effect models, country-by-country (2)") ///
			mtitles("France" "Germany" "Greece" "Hungary" "Ireland" "Italy" "Latvia" "Lithuania") ///
			drop()  ///
						coeflabels(threat_ind2 "Threat perception" ///
						2.idconfig2 "Inclusive identity" ///
						3.idconfig2 "No territorial ID" ///
						iso "Isolationism" ///
						comp "Willingness to compromise" ///
						mili "Attitudes towards the use of force" ///
						age "Age (in years)" ///
						female "Gender (female)" ///
						1.education "Formal education: low" ///
						3.education "Formal education: high" ///
						_cons "Constant") ///
			order(threat_ind2 2.idconfig2 3.idconfig2 iso comp mili age female 1.education 3.education)

	esttab 	m17 m18 m19 m20 m21 m22 m23 m24 m25 using "A4_2c.rtf", replace ///
			b(2) se(2) nogaps compress nobaselevels varwidth(15) ///
			modelwidth(6) nonumbers ///
			title("Average effect models, country-by-country (3)") ///
			mtitles("Netherl." "Poland" "Portugal" "Romania" "Slovakia" "Slovenia" "Spain" "Sweden" "UK") ///
			drop()  ///
						coeflabels(threat_ind2 "Threat perception" ///
						2.idconfig2 "Inclusive identity" ///
						3.idconfig2 "No territorial ID" ///
						iso "Isolationism" ///
						comp "Willingness to compromise" ///
						mili "Attitudes towards the use of force" ///
						age "Age (in years)" ///
						female "Gender (female)" ///
						1.education "Formal education: low" ///
						3.education "Formal education: high" ///
						_cons "Constant") ///
			order(threat_ind2 2.idconfig2 3.idconfig2 iso comp mili age female 1.education 3.education)


*** Appendix A4, Table A4.3
	
	use DATA_clean, clear

	forvalues val = 1/25 {
	reg csdp_wouldlike c.threat_ind2##i.idconfig2 female age ib2.education iso comp mili if QCOUNTRY==`val'
	estimates store m`val'
}

	esttab 	m1 m2 m3 m4 m5 m6 m7 m8 using "A4_3a.rtf", replace ///
			b(2) se(2) nogaps compress nobaselevels varwidth(15) ///
			modelwidth(6) nonumbers ///
			title("Interaction effects models, country-by-country (1)") ///
			mtitles("Austria" "Belgium" "Bulgaria" "Croatia" "Czech Republic" "Denmark" "Estonia" "Finland") ///
			drop()  ///
						coeflabels(threat_ind2 "Threat perception" ///
						2.idconfig2 "Inclusive identity" ///
						3.idconfig2 "No territorial ID" ///
						2.idconfig2#c.threat_ind2 "Inclusive identity * Threat perception" ///
						3.idconfig2#c.threat_ind2 "No territorial ID * Threat perception" ///
						iso "Isolationism" ///
						comp "Willingness to compromise" ///
						mili "Attitudes towards the use of force" ///
						age "Age (in years)" ///
						female "Gender (female)" ///
						1.education "Formal education: low" ///
						3.education "Formal education: high" ///
						_cons "Constant") ///
			order(threat_ind2 2.idconfig2 3.idconfig2 2.idconfig2#c.threat_ind2 3.idconfig2#c.threat_ind2 iso comp mili age female 1.education 3.education)

	esttab 	m9 m10 m11 m12 m13 m14 m15 m16 using "A4_3b.rtf", replace ///
			b(2) se(2) nogaps compress nobaselevels varwidth(15) ///
			modelwidth(6) nonumbers ///
			title("Interaction effects models, country-by-country (2)") ///
			mtitles("France" "Germany" "Greece" "Hungary" "Ireland" "Italy" "Latvia" "Lithuania") ///
			drop()  ///
						coeflabels(threat_ind2 "Threat perception" ///
						2.idconfig2 "Inclusive identity" ///
						3.idconfig2 "No territorial ID" ///
						2.idconfig2#c.threat_ind2 "Inclusive identity * Threat perception" ///
						3.idconfig2#c.threat_ind2 "No territorial ID * Threat perception" ///
						iso "Isolationism" ///
						comp "Willingness to compromise" ///
						mili "Attitudes towards the use of force" ///
						age "Age (in years)" ///
						female "Gender (female)" ///
						1.education "Formal education: low" ///
						3.education "Formal education: high" ///
						_cons "Constant") ///
			order(threat_ind2 2.idconfig2 3.idconfig2 2.idconfig2#c.threat_ind2 3.idconfig2#c.threat_ind2 iso comp mili age female 1.education 3.education)

	esttab 	m17 m18 m19 m20 m21 m22 m23 m24 m25 using "A4_3c.rtf", replace ///
			b(2) se(2) nogaps compress nobaselevels varwidth(15) ///
			modelwidth(6) nonumbers ///
			title("Interaction effects models, country-by-country (3)") ///
			mtitles("Netherl." "Poland" "Portugal" "Romania" "Slovakia" "Slovenia" "Spain" "Sweden" "UK") ///
			drop()  ///
						coeflabels(threat_ind2 "Threat perception" ///
						2.idconfig2 "Inclusive identity" ///
						3.idconfig2 "No territorial ID" ///
						2.idconfig2#c.threat_ind2 "Inclusive identity * Threat perception" ///
						3.idconfig2#c.threat_ind2 "No territorial ID * Threat perception" ///
						iso "Isolationism" ///
						comp "Willingness to compromise" ///
						mili "Attitudes towards the use of force" ///
						age "Age (in years)" ///
						female "Gender (female)" ///
						1.education "Formal education: low" ///
						3.education "Formal education: high" ///
						_cons "Constant") ///
			order(threat_ind2 2.idconfig2 3.idconfig2 2.idconfig2#c.threat_ind2 3.idconfig2#c.threat_ind2 iso comp mili age female 1.education 3.education)
